<div class="page-content">
	<div class="row">
		<div class="col-xs-12"> 
	
			<div id="alert_box_table"></div>

			<div class="well well-sm">
				<div class="row">
					<div class="col-sm-3 padding0">
						<div class="input-group">
							<select name="search_device_type" id="search_device_type" class="form-control" style="height:34px;">
				    			<option value="">请选择设备类型</option>
				    			<option value="Phone" <if condition="$param['device_type'] eq 'Phone' ">selected</if>>手机</option>
				    			<option value="computer" <if condition="$param['device_type'] eq 'computer' ">selected</if>>电脑</option>
				    			<option value="Tablet" <if condition="$param['device_type'] eq 'Tablet' ">selected</if>>平板电脑</option>
							</select>
							<span class="input-group-btn">
								
							</span>
						
							<select name="search_auth_type" id="search_auth_type" class="form-control" style="height:34px;">
				    			<option value="">请选择登录方式</option>
				    			<option value="akey_verify" <if condition="$param['auth_type'] eq 'akey_verify' ">selected</if>>一键认证</option>
				    			<option value="weixin_verify" <if condition="$param['auth_type'] eq 'weixin_verify' ">selected</if>>微信认证</option>
				    			<option value="mobile" <if condition="$param['auth_type'] eq 'mobile' ">selected</if>>短信认证</option>
				    			<option value="virtualmobile" <if condition="$param['auth_type'] eq 'virtualmobile' ">selected</if>>虚拟短信认证</option>
				    			<option value="qq" <if condition="$param['auth_type'] eq 'qq' ">selected</if>>QQ认证</option>
				    			<option value="weibo" <if condition="$param['auth_type'] eq 'weibo' ">selected</if>>微博认证</option>
							</select>
							
							
						</div>
						
					</div>
					<div class="col-sm-6 padding0">
						<div class="input-group">

							<select name="date_type" id="date_type" class="form-control" style="height:34px;">
				    	
				    			<option value="create_time" <if condition="$param['date_type'] eq 'create_time' ">selected</if>>注册时间</option>
				    			<option value="lastvisit_time" <if condition="$param['date_type'] eq 'lastvisit_time' ">selected</if>>最后登录时间</option>
							</select>
							<span class="input-group-btn">
								
							</span>
							<input  type="text" class="form-control Wdate" type="text" onFocus="WdatePicker({isShowClear:false})" name="time_start" id="time_start" placeholder="起始日期" value="{$param['time_start']}"/>
							<span class="input-group-btn">
								<button type="button" disabled style="border-radius:0px;" class="btn btn-default" ><i class="icon-long-arrow-right"></i></button>
							</span>
							<input type="text" class="form-control Wdate" onFocus="WdatePicker({isShowClear:false})" name="time_end" id="time_end" placeholder="结束日期" value="{$param['time_end']}"/>
							 
						</div>
					</div>
					
					
					<div class="col-sm-2 padding0">
						<button  class="btn btn-sm btn-white" style="height: 34px;" id="seach_btn">
						<i class="icon-search green bigger-130"></i>
						<span class="bigger-110 no-text-shadow">搜索</span>
						</button>
						<button  class="btn btn-sm btn-white" style="height: 34px;" id="download_execl">
						<i class="icon-download green bigger-130"></i>
						<span class="bigger-110 no-text-shadow">导出数据</span>
						</button>

					</div> 

				</div>
			</div>
			<div class="space-4"></div>
			<div class="table-responsive">

				{:NW('Table',array(
						'columns'=>array(
							array('name'=>'router_name','text'=>'路由名称','width'=>'12%'),
							array('name'=>'username','text'=>'用户名','width'=>'10%','sortable'=>false),
							array('name'=>'auth_type','text'=>'登录方式','width'=>'12%','sortable'=>true),
							array('name'=>'times','text'=>'认证次数','width'=>'12%','sortable'=>true),
							array('name'=>'create_time','text'=>'注册时间','width'=>'12%','sortable'=>true),
							array('name'=>'lastvisit_time','text'=>'最后登录时间','width'=>'12%','sortable'=>true),
							
							array('name'=>'device_type','text'=>'设备类型','width'=>'15%','sortable'=>true),
						), 
						'default'	=> '空',
						'rows'		=> !is_array($rows) ? array() : $rows ,
						'button_width'	=>'15%',
						'button' 	=> array(
							0	=> array('class'=>'blue', 'icon'=>'search', 'name'=>'user_info', 'title'=>'用户详情', 'field'=>array('id')),
							
						),
					) ,'User'
				)}
				
			</div>

			{:W('Page/index', array('total'=>$count, 'rp'=>$pagelen, 'param'=>$param))}
			
		</div>
	</div>
</div>

<script type="text/javascript">
	$(document).ready(function(){
		$("a[name='user_info']").click(function(){
			var field = $(this).attr('value');
			if (field == ''){
				$("#alert_box_table").jk_alert({msg: '没有获取到要查看的数据，请刷新后重试', type:'danger', show_time:12000});
				return false;
			}
	
			
			
			dialog({
				id: 'test-dialog',
				title: '用户详情',
				width:600,
				height:270,
				padding:0,
				url: "{:U('Client/user_info')}?id="+field
			}).show();
		});
		$('#search_device_type').change(function(){
			window.location.href = search();
		});
		$('#search_auth_type').change(function(){
			window.location.href = search();
		});
		$('#router_mac').change(function(){
			window.location.href = search();
		});
		$('#listRows').change(function(){
			window.location.href = search();
		})
		$("th[name='sort']").click(function(){

			window.location.href = search()+'&reverse='+$(this).attr('id')+'&sortkey='+$(this).attr('field');
		});
		$('#seach_btn').click(function(){
			window.location.href = search();
		});
		$('#download_execl').click(function(){
			var search_auth_type = $('#search_auth_type').val();
			var router_mac = $('#router_mac').val();
			
			var time_start = $('#time_start').val();
			var time_end = $('#time_end').val();
			window.location.href = "{:U('Client/download_execl_for_userlist')}?auth_type="+search_auth_type+'&router_mac='+router_mac+'&time_start='+time_start+'&time_end='+time_end;
		});
	});
	function search(){
		var search_device_type = $('#search_device_type').val();
		var search_auth_type = $('#search_auth_type').val();
		var router_mac = $('#router_mac').val();
		var date_type = $('#date_type').val();
		var time_start = $('#time_start').val();
		var time_end = $('#time_end').val();
		var listRows = $('#listRows').val();
		return "{:U('Client/userlist')}?pagelen="+listRows+'&auth_type='+search_auth_type+'&device_type='+search_device_type+'&router_mac='+router_mac+'&date_type='+date_type+'&time_start='+time_start+'&time_end='+time_end;
	}
</script>